# -*- coding: utf-8 -*-
# @Time : 2021/9/18 9:07
# @Author : Mr  jelis
# @Email : 1402615849@qq.com
# @File : toast.py
# @Project : mryx_test
"""抓取弹框内容"""
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from appium.webdriver.common.mobileby import MobileBy as By
from time import sleep
class Toast():
    def __init__(self,driver):
        self.driver=driver
    def toast(self,text):
        locator=(By.XPATH,'//*[@text="{}"]'.format(text))
        sleep(3)
        self.driver.press_keycode(4)
        sleep(5)
        wait=WebDriverWait(self.driver,10,0.5)
        a=wait.until(EC.presence_of_element_located(locator)).text
        return a
